package com.teziyou.commodity.validator;

import com.jfinal.aop.Interceptor;
import com.jfinal.core.ActionInvocation;
import com.jfinal.core.Controller;

public class DistributorValidator extends BaseValidator implements Interceptor {

	@Override
	public void intercept(ActionInvocation ai) {
		Controller c = ai.getController();
		boolean flag = false;
		flag = validateRequired(c.getPara("distributor.name"));
		if(!flag) {
			c.renderJson(fail("分销商名称不能为空！！"));
			return;
		}
		flag = validateInt(c.getPara("distributor.registered_capital", "0"));
		if(!flag) {
			c.renderJson(fail("注册资本只能是数字！！"));
			return;
		}
		ai.invoke();
	}

}
